/*
 *
 * Author Administrator
 * Date 2021/9/22 15:19
 */
package cn.safekeeper.guide.admin.config;

import cn.safekeeper.guide.admin.filter.MyFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyFilterConfig {

    @Autowired
    private MyFilter myFilter;

    @Bean
    public FilterRegistrationBean registerMyFilter() {
        FilterRegistrationBean<MyFilter> registration = new FilterRegistrationBean<>();
        registration.setFilter(myFilter);
        registration.addUrlPatterns("/*");
        registration.setName("myFilter");
        return registration;
    }
}
